/**
 The MIT License

Copyright (c) <2011> <JPACHUBE Team>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
 */
package com.pachube.api;

import java.awt.Color;
import java.net.URL;
import java.util.ArrayList;

import com.pachube.exceptions.PachubeException;

/**
 * The Interface Feed.
 */
public interface Feed {

    /**
     * Creates a datastream on this feed.
     * 
     * @param d Datastream
     * @throws PachubeException the pachube exception
     */
    public void createDatastream(Data d) throws PachubeException;

    /**
     * Deletes a datastream.
     * 
     * @param id id of the datastream to delete
     */
    public void deleteDatastream(int id);

    /**
     * Updates a Datastream.
     * 
     * @param id id of the datastream to update
     * @param value new datastream to replace the previous datastream
     */
    public void updateDatastream(int id, Double value);

    /**
     * Updates a Datastream.
     * 
     * @param data the data update
     */
    public void updateDatastream(Data data);

    /**
     * Gets a datastream from the feed.
     * 
     * @param id id of the datastream to get
     * @return the datastream
     */
    public Double getDatastream(int id);

    /**
     * Gets the last 24 hours values from a datastream.
     * 
     * @param id id of datastream
     * @return the datastream history
     */
    public Double[] getDatastreamHistory(int id);

    /**
     * Gets all values submitted to datastream since its creation.
     * 
     * @param id the id
     * @return the datastream archive
     */
    public String[] getDatastreamArchive(int id);

    /**
     * Get the url of a graph.
     * 
     * @param id id of the datastream
     * @param width Width of the Image
     * @param height Height of the Image
     * @param c Color of the Line on the graph
     * @return the graph
     */
    public String getGraph(int id, int width, int height, Color c);

    /**
     * Add a datastream to the internal data collection This method does not
     * automatically submit data to pachube, this method is intended for the
     * creation of feeds.
     * 
     * @param d the d
     */
    public void addData(Data d);

    /**
     * Gets the id of the Feed.
     * 
     * @return the id
     */
    public int getId();

    /**
     * sets the id of the feed, this is not intended for users to use. When
     * creating a new datastream to submit to pachube, Pachube will provide a
     * Unique id. THIS METHOD SHOULD ONLY BE USED BY THE PachubeFactory.
     * 
     * @param id the new id
     */
    public void setId(int id);

    /**
     * sets the id of the feed, this is not intended for users to use. When
     * creating a new datastream to submit to pachube, Pachube will provide a
     * Unique id. THIS METHOD SHOULD ONLY BE USED BY THE PachubeFactory.
     * 
     * @param id the new id
     */
    public void setId(String id);

    /**
     * Gets the title of the feed.
     * 
     * @return the title
     */
    public String getTitle();

    /**
     * Sets the title of the feed, this method will submit any changes to
     * Pachube.
     * 
     * @param title the new title
     * @throws PachubeException the pachube exception
     */
    public void setTitle(String title) throws PachubeException;

    /**
     * Gets when the feed was last updated, this will be the last time the feed
     * was update after getting the feed from pachube.
     * 
     * @return the updated
     */
    public String getUpdated();

    /**
     * Sets when the feed was last updated, this method is not intended for
     * users to use. THIS METHOD IS INTENDED TO BE USED BY THE PachubeFactory.
     * 
     * @param updated the new updated
     */
    public void setUpdated(String updated);

    /**
     * Gets the Url of the Feed.
     * 
     * @return the feed
     */
    public URL getFeed();

    /**
     * Sets the Url of the feed, this method is not intended for users to use.
     * THIS METHOD IS INTENDED TO BE USED BY THE PachubeFactory.
     * 
     * @param feed the new feed
     */
    public void setFeed(URL feed);

    /**
     * Gets the status of the feed when the feed was featched from pachube.
     * 
     * @return the status
     */
    public Status getStatus();

    /**
     * Sets the url of the feed.
     * 
     * @param status the new status
     * @throws PachubeException the pachube exception
     */
    public void setStatus(Status status) throws PachubeException;

    /**
     * Gets the Description of the feed.
     * 
     * @return the description
     */
    public String getDescription();

    /**
     * Sets the Description of the feed.
     * 
     * @param description the new description
     * @throws PachubeException the pachube exception
     */
    public void setDescription(String description) throws PachubeException;

    /**
     * Gets the URL of the website associated with the feed.
     * 
     * @return the website
     */
    public URL getWebsite();

    /**
     * Sets the URL of the website associated with the feed.
     * 
     * @param website the new website
     * @throws PachubeException the pachube exception
     */
    public void setWebsite(URL website) throws PachubeException;

    /**
     * Gets the publicly available email address of this feed.
     * 
     * @return the email
     */
    public String getEmail();

    /**
     * Sets the publicly available email address of thie feed. THE EMAIL ADDRESS
     * WILL BE PUBLICLY AVAILABLE, DO NOT USE AN EMAIL ADDRESS YOU WISH TO KEEP
     * PRIVATE
     * 
     * @param email the new email
     * @throws PachubeException the pachube exception
     */
    public void setEmail(String email) throws PachubeException;

    /**
     * Gets the Location details of the feed.
     * 
     * @return the location
     */
    public Location getLocation();

    /**
     * Sets the location detals of the feed.
     * 
     * @param location the new location
     * @throws PachubeException the pachube exception
     */
    public void setLocation(Location location) throws PachubeException;

    /**
     * Get a list of all datastreams in the feed.
     * 
     * @return the data
     */
    public ArrayList<Data> getData();

    /**
     * Sets a list of all datastream in the feed.
     * 
     * @param data the new data
     */
    public void setData(ArrayList<Data> data);

    /**
     * Produces eeml of this feed with any datastream information.
     * 
     * @return String of well formed eeml
     */
    public String toXML();

    /**
     * To string.
     * 
     * @return the string
     */
    public String toString();

    /**
     * Sets the created.
     * 
     * @param Created the new created
     */
    public void setCreated(boolean Created);

}